<?php
/**
 * Created by PhpStorm.
 * User: 23783
 * Date: 2018/3/12
 * Time: 14:10
 */
namespace Controllers\Index;
use  Common\CommonMethod;
use Controllers\Category\TravelExpense;
use Controllers\Category\ApplicationLoan;
use Controllers\Category\ExtraBudgetaryPayment;
use Controllers\Category\BudgetaryPayment;
use Controllers\Category\BusinessEntertaining;



class Index{
    //业务招待费报销单
    const BusinessEntertaining ='business_entertaining';
    //借款申请单
    const ApplicationLoan = 'application_loan';
    //预算外付款申请单
    const ExtraBudgetaryPayment = 'extra_budgetary_payment';
    //预算外付款申请单
    const BudgetaryPayment = 'budgetary_payment';
    //请假申请单
    const LeaveApproval = 'leave_approval';
    //差旅单报销单
    const TravelExpense = 'travel_expense';

    protected $common;
    protected $travel;
    protected $loan;
    protected $besides;
    protected $inner;
    protected $bsiness;
    public function __construct()
    {
        $this->common= new CommonMethod();
        $this->travel= new TravelExpense();
        $this->loan = new ApplicationLoan();
        $this->besides = new ExtraBudgetaryPayment();
        $this->inner = new BudgetaryPayment();
        $this->bsiness=new BusinessEntertaining();
    }
    /**
     *加载PDF模块
     */
    function LoadPdfModule(){
        $document_id = $_GET['document_id'];
//        if($document_id==614){
            $code = $this->common->GetIblockById($document_id);
//        }else{
//            //TODO 设置调试模块 【测试使用】
//            $template_id = $document_id;
//        }
        switch ($code){
            case $code=self::ApplicationLoan:
//                $this->loan->GetWorkflowState($document_id);//借款申请单
                break;
            case $code=self::ExtraBudgetaryPayment:
//                $this->besides->GetWorkflowState($document_id);//预算外付款申请单
                break;
            case $code=self::BudgetaryPayment:
//                $this->inner->GetWorkflowState($document_id);//预算内付款申请单
                break;
            case $code=self::LeaveApproval:
//               echo '請假';
                break;
            case $code=self::TravelExpense:
//                $this->travel->GetWorkflowState($document_id);//差旅单报销单
                break;
            case $code=self::BusinessEntertaining:
                $this->bsiness->GetWorkflowState($document_id);//业务招待费报销单
                break;
            default:
                exit('非法访问！');
        }
    }
}